#include "MenuBar.h"
#include "MainWindow.h"
#include "Controller.h"

#include <QMessageBox>


MenuBar::MenuBar(Controller* owner) : QMenuBar(), m_owner(owner)
{
    initialize();
}

MenuBar::~MenuBar()
{
    cleanup();
}

void MenuBar::initialize()
{
    // Menu's
    
    m_fileMenu = new QMenu("&File");
    this->addMenu(m_fileMenu);

    m_helpMenu = new QMenu("&Help");
    this->addMenu(m_helpMenu);
    
	// Icons

	//QIcon iNew("./icons/new.gif");
	QIcon iClose("./icons/exit.gif");
	QIcon iAbout("./icons/about.gif");

    // Actions
    
	m_inviteAction = new QAction("&Invite", this);
	m_closeAction = new QAction(iClose, "&Close", this);
	m_aboutAction = new QAction(iAbout, "&About", this);

	// Add action to menu's

	m_fileMenu->addAction(m_inviteAction);
	m_fileMenu->addSeparator();
	m_fileMenu->addAction(m_closeAction);

	m_helpMenu->addAction(m_aboutAction);
}

void MenuBar::cleanup()
{
    
}

void MenuBar::slotInvite()
{
	m_owner->inviteSelectedContact();
}

void MenuBar::slotShutDown()
{
	m_owner->shutDown();
}

void MenuBar::slotAbout()
{
	QMessageBox::information(this, QString("About"), QString("Created by Maarten Lambert & Benji Mommen"));
}
